Open A New Window


What's that?

You can also open new windows and set them to close within setTimeout. Here's how:

				
STEP ONE
Leave A Message:
< p >Click the button to open a new window. After 3 seconds it will close on its own (spooky).< / p >

STEP TWO
Make The Button:
< button onclick="openWin()">open me< /button >

STEP THREE
Activate The Script:
< script >
function openWin() {
    var myWindow = window.open("", "myWindow", "width=200, height=100");
    myWindow.document.write("< p >nyello!< /p >");
    setTimeout(function(){ myWindow.close() }, 3000);
}< / script >

				
			

 

Code in action!

View at full scale